package cn.xinfei.xdecision.common.model.common;

import com.github.pagehelper.PageInfo;
import lombok.Data;

import java.util.List;

/**
 * @author zdy
 * @since 2023-05-05
 */
@Data
public class PageResultNew<T> {
    private List<T> klist;

    private PageInfo<T> pageInfo;

    public static <T> ResponseEntityDto<PageResultNew<T>> success(List<T> kList) {
        ResponseEntityDto<PageResultNew<T>> responseEntityDto = new ResponseEntityDto<>();
        PageResultNew<T> pageResult = new PageResultNew<>();
        pageResult.setKlist(kList);
        PageInfo<T> pageInfo = new PageInfo<>(kList);
        pageInfo.setList(null);
        pageResult.setPageInfo(pageInfo);
        responseEntityDto.setStatus(ResponseEntityBuilder.RESPONSE_OK);
        responseEntityDto.setError("00000000");
        responseEntityDto.setData(pageResult);
        return responseEntityDto;
    }

}
